package org.bud.excel.expot.fmt;

import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bud.data.bit.ask.FmtAsk;
import org.bud.data.bit.check.CheckData;
import org.bud.data.bit.fmt.FmtType;
import org.bud.excel.expot.constant.Constant;

import java.util.function.Supplier;
import java.util.function.UnaryOperator;

/**
 * @author shaun
 * @date 2024/7/21
 * @instruction
 */
@Data
@NoArgsConstructor
public class ExcelFmtAsk extends FmtAsk {
    private String format;

    public ExcelFmtAsk(FmtType type, CheckData check,
                       UnaryOperator<?> fmt,
                       Supplier<?> defaultValueSupplier,
                       String format){
        super(type,check,fmt,defaultValueSupplier);
        this.format = format;
    }

    public static ExcelFmtAsk of(
            FmtType type,CheckData check,
            UnaryOperator<?> fmt,
            Supplier<?> defaultValueSupplier,
            String format){
        return new ExcelFmtAsk(type,check,fmt,defaultValueSupplier,format);
    }

    public static ExcelFmtAsk emtpy(){
        return new ExcelFmtAsk(FmtType.STRING,null,b -> b,() -> null, Constant.FMT_STRING);
    }

}
